package com.hhxyjsj.singleton;

import java.util.HashSet;
import java.util.Set;

/**
 * 单例设计模式测试类
 * 
 * @author Puhui
 *
 */
public class CalculatorTest {

	public static void main(String[] args) {
		Set<String> set = new HashSet<String>();
		//循环100次看创建了多少个对象
		for(int i = 1;i <= 100; i++){
			Calculator calculator = Calculator.getInance();
			if(set.add(calculator.toString())){
				System.out.println("创建一个了新对象！");
			}
			calculator.add(i, i);
		}
		
	}

}
